home *** CD-ROM | disk | FTP | other *** search
- Program Checkbook (input,output);
- {$I auxsubs.pas}
-
- var
- Pbalance:real;
- Selection:char;
- infile,outfile:text;
-
-
- Procedure Balance (var Bbalance:real);
-
- Begin
- gotoxy (3,26);
- writeln ('Checkbook Balance Program ');
- gotoxy (5,65);
- writeln ('BALANCE ');
- gotoxy (7,64);
- writeln (pbalance:8:2)
- end;
-
- Procedure Menu;
-
- Begin
- balance (pbalance);
- writeln (' C) Enter a Check?');
- writeln;
- writeln (' D) Enter a Deposit?');
- writeln;
- writeln (' I) Enter Interest?');
- writeln;
- writeln (' F) Enter Fees?');
- writeln;
- writeln (' R) Reset Balance?');
- writeln;
- writeln (' Q) Quit?');
- writeln;
- write (' What is your selection? ')
- end;
-
-
- Procedure Check (var Cbalance:real);
-
- var
- cvalue:real;
- cquit:char;
-
-
- Begin
- Repeat
- clrscrn;
- balance (cbalance);
- gotoxy (8,10);
- write ('Enter the amount of the check written $ ');
- readln (cvalue);
- cbalance:=cbalance-cvalue;
- balance (cbalance);
- gotoxy (10,10);
- write ('Do you have another check to enter? (Y/N) ');
- readln (cquit);
- Until cquit in ['n','N']
- end;
-
-
- Procedure Deposit (var Dbalance:real);
-
- var
- dvalue:real;
- dquit:char;
-
- Begin
- Repeat
- clrscrn;
- balance (dbalance);
- gotoxy (8,10);
- write ('Enter the amount of the deposit $ ');
- readln (dvalue);
- dbalance:=dbalance+dvalue;
- balance (dbalance);
- gotoxy (10,10);
- write ('Do you have another deposit to enter? (Y/N) ');
- readln (dquit);
- Until dquit in ['n','N']
- end;
-
-
- Procedure Interest (var Ibalance:real);
-
- var
- ivalue:real;
- iquit:char;
-
- Begin
- Repeat
- clrscrn;
- balance (ibalance);
- gotoxy (8,10);
- write ('Enter the amount of interest earned $ ');
- readln (ivalue);
- ibalance:=ibalance+ivalue;
- balance (ibalance);
- gotoxy (10,10);
- write ('Do you have more interest to enter? (Y/N) ');
- readln (iquit);
- Until iquit in ['n','N']
- end;
-
-
- Procedure Fees (var Fbalance:real);
-
- var
- fvalue:real;
- fquit:char;
-
- Begin
- Repeat
- clrscrn;
- balance (fbalance);
- gotoxy (9,5);
- write ('Enter the amount of the fee deducted from your account $ ');
- readln (fvalue);
- fbalance:=fbalance-fvalue;
- balance (fbalance);
- gotoxy (11,8);
- write ('Do you have more fees to enter? (Y/N) ');
- readln (fquit);
- Until fquit in ['n','N']
- end;
-
-
- Procedure Rreset (var rbalance:real);
-
- var
- rchange:char;
-
- Begin
- clrscrn;
- balance (rbalance);
- gotoxy (9,10);
- write ('Do you wish to change your balance? (Y/N) ');
- readln (rchange);
- if rchange in ['y','Y'] then
- begin
- gotoxy (11,17);
- write ('Input the correct balance $ ');
- readln (rbalance)
- end
- end;
-
-
-
- BEGIN
-
- reset (infile,'check.dat');
- readln (infile,pbalance);
- close (infile);
-
- Repeat
- clrscrn;
- menu;
- readln (selection);
-
- Case selection of
-
- 'c','C':check (pbalance);
- 'd','D':deposit (pbalance);
- 'i','I':interest (pbalance);
- 'f','F':fees (pbalance);
- 'r','R':rreset (pbalance);
- 'q','Q': ;
- else:
- begin
- writeln;
- writeln (' You must select C, D, I, F, Q, or R ');
- writeln;
- write (' Press return to continue ');
- readln
- end
- end;
-
- Until selection in['q','Q'];
- rewrite (outfile,'check.dat');
- writeln (outfile,pbalance);
-
- clrscrn
-
- END.
-